<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * Base model to config connect database info 
 */
namespace Album\Model;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\Adapter\Adapter;
class BaseModel implements ServiceLocatorAwareInterface{
    
    protected $serviceLocator;
    protected $_db;
    protected  $adapter;
    //
   
    public function setServiceLocator(ServiceLocatorInterface $sl){
        $this->serviceLocator = $sl;
        return $this;
    }
    //
    public function getServiceLocator(){
        return $this->serviceLocator;
    }
     public function getAdapter()
    {
       if (!$this->adapter) {
          $sm = $this->getServiceLocator();
          $this->adapter = $sm->get('Zend\Db\Adapter\Adapter');
       }
       return $this->adapter;
    }
    
}